package cn.com.nes.site.module.service;

import cn.com.nes.common.util.DBUtils;
import cn.com.nes.site.entity.DataReq;
import cn.com.nes.site.entity.MallUserInfo;
import cn.com.nes.site.entity.PageData;
import cn.com.nes.site.entity.UserInfo;
import cn.com.nes.site.entity.sms.VerCodeReq;
import cn.com.nes.site.entity.vo.user.SaveBusinessCompanyVo;
import cn.com.nes.site.module.dao.UserConnDaoImpl;
import cn.com.nes.site.module.dao.UserDaoImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.List;
import java.util.Map;

@Service
public class UserService {
	@Resource
	private UserDaoImpl impl;

	@Resource
	private UserConnDaoImpl impl_conn;
	
	public PageData login(DataReq req)  {
		return impl.login(req);
	}

	public PageData getShopToken(DataReq req) {
		return impl.getShopToken(req);
	}

	public PageData getKeyByToken(DataReq req)  {
		return impl.getKeyByToken(req);
	}
	
	public PageData getUsers(DataReq req)  {
		return impl.getUsers(req);
	}
	
	public PageData getUserMesg(DataReq req)  {
		return impl.getUserMesg(req);
	}
	
	public PageData updateUser(DataReq req)  {
		return impl.updateUser(req);
	}
	
	public PageData checkCret(DataReq req)  {
		return impl.checkCret(req);
	}
	
	public PageData saveBusinessLicense(DataReq req)  {
		return impl.saveBusinessLicense(req);
	}
	
	public PageData saveUser(DataReq req)  {
		return impl.saveUser(req);
	}
	
	public PageData delUser(DataReq req)  {
		return impl.delUser(req);
	}
	
	public PageData saveRoleAndModel(DataReq req)  {
		return impl.saveRoleAndModel(req);
	}
	
	public PageData delRoleAndModel(DataReq req)  {
		return impl.delRoleAndModel(req);
	}
	
	public PageData getRoles(DataReq req)  {
		return impl.getRoles(req);
	}

	public PageData getRoles_new(DataReq req)  {
		return impl.getRoles_new(req);
	}
	
	public PageData getModels(DataReq req)  {
		return impl.getModels(req);
	}

	public PageData getModels_new(DataReq req)  {
		return impl.getModels_new(req);
	}
	
	public PageData getAreaInfo(DataReq req)  {
		return impl.getAreaInfo(req);
	}
	
	public PageData getParam(DataReq req)  {
		return impl.getParam(req);
	}
	
	public PageData saveParam(DataReq req)  {
		return impl.saveParam(req);
	}
	
	public PageData delParam(DataReq req)  {
		return impl.delParam(req);
	}

	public PageData getCompany(DataReq req)  {
		return impl.getCompany(req);
	}
	
	public PageData saveCompany(DataReq req)  {
		return impl.saveCompany(req);
	}
	
	public PageData delCompany(DataReq req)  {
		return impl.delCompany(req);
	}
	
	public PageData saveDepartment(DataReq req)  {
		return impl.saveDepartment(req);
	}
	
	public PageData getRolelist(DataReq req)  {
		return impl.getRolelist(req);
	}
	
	public PageData getCompanyList(DataReq req)  {
		return impl.getCompanyList(req);
	}
	
	public PageData getDepartmentList(DataReq req)  {
		return impl.getDepartmentList(req);
	}
	
	public PageData getProjectList(DataReq req)  {
		return impl.getProjectList(req);
	}
	
	public PageData getNesCompanyList(DataReq req)  {
		return impl.getNesCompanyList(req);
	}
	
	public PageData getNesSbmcList(DataReq req)  {
		return impl.getNesSbmcList(req);
	}
	
	public PageData getNesSbxhList(DataReq req)  {
		return impl.getNesSbxhList(req);
	}
	
	public PageData getAppHome(DataReq req)  {
		return impl.getAppHome(req);
	}
	
	public PageData onlineReg(DataReq req)  {
		return impl.onlineReg(req);
	}
	
	public PageData userReg(DataReq req)  {
		return impl.userReg(req);
	}
	
	public PageData updatePassword(DataReq req)  {
		return impl.updatePassword(req);
	}
	
	public PageData updateMfepuser(DataReq req)  {
		return impl.updateMfepuser(req);
	}
	
	public PageData getAgentFacturer(DataReq req)  {
		return impl.getAgentFacturer(req);
	}
	
	public PageData getAgentFacturerWdl(DataReq req)  {
		return impl.getAgentFacturerWdl(req);
	}
	
	public PageData delAgentFacturer(DataReq req)  {
		return impl.delAgentFacturer(req);
	}
	
	public PageData addAgentFacturer(DataReq req)  {
		return impl.addAgentFacturer(req);
	}
	
	public PageData getLogs(DataReq req)  {
		return impl.getLogs(req);
	}
	
	public PageData getUserPic(DataReq req) throws SQLException  {
		PageData res = new PageData();
		Connection conn = null;
		try {
			conn = DBUtils.getJNDIDBConn();
			res = impl.getUserPic(conn,req);
		} catch (Exception e) {
			e.printStackTrace();
			conn.rollback();
		} finally {
			if (conn != null)
				conn.close();
		}
		return res;
	}
	public boolean checkPhone(String phone) throws SQLException  {
		return impl_conn.checkPhone(phone);
	}
	
	public int InsertSmsCode(VerCodeReq sms) throws SQLException  {
		return impl_conn.InsertSmsCode(sms);
	}

	public PageData getAd(DataReq req) throws SQLException {
		PageData res = new PageData();
		Connection conn = null;
		try {
			conn = DBUtils.getJNDIDBConn();
			res = impl.getAd(conn,req);
		} catch (Exception e) {
			e.printStackTrace();
			conn.rollback();
		} finally {
			if (conn != null)
				conn.close();
		}
		return res;
	}
	
	public PageData sendCoupon(DataReq req) throws SQLException {
		return impl.sendCoupon(req);
	}
	public PageData userLoginLogList(DataReq req) throws SQLException {
		return impl.userLoginLogList(req);
	}
	public PageData userLoginLogCount(DataReq req) throws SQLException {
		return impl.userLoginLogCount(req);
	}

	public PageData getRoomUseTypes(DataReq req) throws SQLException {
		return impl.getRoomUseTypes(req);
	}

	public PageData getLoadParam(DataReq req) throws SQLException {
		return impl.getLoadParam(req);
	}


	public PageData getUsersInCompany(DataReq req) {
		return impl.getUsersInCompany(req);
	}

	public PageData getMerList(DataReq req)  {
		return impl.getMerList(req);
	}

	public PageData getCcToken(DataReq req) {
		return impl.getCcToken(req);
	}

	public List<Map<String,Object>> getNearCSSInfo(DataReq req)throws SQLException { return impl.getNearCSSInfo(req);}

	public PageData getUserInfo(DataReq req) {
		return impl.getUserInfo(req);
	}

	public PageData checkedUsers(DataReq req){
		return impl.checkedUsers(req);
	}

	public UserInfo selectUserByCompanyId(String companyId) {
		return impl.selectUserByCompanyId(companyId);
	}

	public void insertUser(UserInfo uinfo) {
		 impl.insertUser(uinfo);

	}

	public void processSuperAdminUser(String companyId, SaveBusinessCompanyVo saveBusinessCompanyVo, MallUserInfo mallUserInfo) {
		impl.processSuperAdminUser(companyId,saveBusinessCompanyVo,mallUserInfo);

	}
}
